<template>
  <shebao v-if="shebao" :area="area"/>
  <jieshao v-else :area="area"/>
</template>
<script>
import shebao from "./counter/Shebao";
import jieshao from "./Jieshao";
export default {
  data() {
    return {
      shebao: false,
      area: '',
      t: null
    };
  },
  components: {
    shebao,
    jieshao
  },
  activated() {
    clearInterval(this.t)
    this.t = setInterval(function(){
      var arr = location.pathname.replace(/\//g, "").split("_");
      if(arr.length && (arr[1] == "shebao" || arr[1] == "shuichou") && arr[0] != this.area ){
        this.area = arr[0]
      }
    }.bind(this), 100)
    var arr = location.pathname.replace(/\//g, "").split("_");
    if (arr.length && arr[1] == "shebao") {
      this.shebao = true;
    } else if (arr.length && arr[1] == "shuichou") {
      this.shebao = false;
    } else {
      this.$router.push({
        path: "/"
      });
    }
    this.area = arr[0];
    this.$parent.tState = 1;
    this.$parent.fState = 1;
  }
};
</script>
